package com.xbongbong.saas.model.impl;

import com.xbongbong.saas.domain.dao.DingReportDao;
import com.xbongbong.saas.domain.entity.DingReportEntity;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import com.xbongbong.saas.model.DingReportModel;
/**
 * @author chenshan
 * @version v1.0
 * @since 2019-08-16 10:50
 */
@Service("dingReportModel")
public class DingReportModelImpl  implements DingReportModel {
	@Resource
	private DingReportDao dingReportDao;

	@Override
	public Integer insert(DingReportEntity entity) {
		long now = DateUtil.getInt();
		entity.setAddTime(now);
		return dingReportDao.insert(entity);
	}

	@Override
	public void insertBatch(List<DingReportEntity> DingReportList) {
		dingReportDao.insertBatch(DingReportList);
	}

	@Override
	public Integer save(DingReportEntity entity) {
		if ( entity.getId() == null || entity.getId().equals(0L) ) {
			return insert(entity);
		}
		return update(entity);
	}

	@Override
	public Integer update(DingReportEntity entity){
		long now = DateUtil.getInt();
			return dingReportDao.update(entity);
		}

	@Override
	public DingReportEntity getEntity( Long id,String corpid) {
		return dingReportDao.getByKey(id,corpid);
		}

	@Override
	public Integer deleteByIds(List<Long> ids,String corpid) {
		return null;//dingReportDao.deleteByIds(ids,corpid);
	}

	@Override
	public List findEntitys(Map<String, Object> param) {
		return dingReportDao.findEntitys(param);
	}
    @Override
    public Integer deleteByRecordTime(String corpid, Integer type,String openConversationId, Long recordTimeStart, Long recordTimeEnd) {
        return dingReportDao.deleteByRecordTime(corpid,type,openConversationId,recordTimeStart,recordTimeEnd);
    }
	@Override
	public Integer getEntitysCount(Map<String, Object> param) {
		return dingReportDao.getEntitysCount(param);
	}
    
    /**
     * Description: 查询符合条件的数据（无子表单数据）
     *
     * @param param
     * @return java.util.List<T>
     * @throws
     * @author 魏荣杰
     * @date 2020/10/13 16:07
     * @since
     */
    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
    
    @Override
	public Integer updateBatch(List<DingReportEntity> dingReportList, String corpid) {
		return dingReportDao.updateBatch(dingReportList,corpid);
	}

	@Override
	public Integer dataConsistencyUpdateUser(String corpid, String userId, String name, String avatar) {
		return dingReportDao.dataConsistencyUpdateUser(corpid, userId, name, avatar);
	}


}